﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Shsc.Net.Common.Validator.Attributes;
using Shsc.Net.Common.Util;

namespace Shsc.Net.Common.Validator.Validators
{
    public class RegexValidator : BaseValidator
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <param name="attribute"></param>
        /// <returns></returns>
        public override bool DoValidate(object value, BaseValidationAttribute attribute)
        {
            RegexAttribute regexAttribute = attribute as RegexAttribute;
            return CheckUtil.CheckByRegex(value, regexAttribute.RegexPattarn);
        }
    }
}
